<?php

!defined('IN_APP') && exit('Access Denied');

class settingmodel extends modelbase {

    function update($setting) {
        foreach($setting as $key=>$value) {
		$this->collection->remove( array('k'=>$key) );
		$this->collection->insert( array('k'=>$key,'v' => $value) );
        }
        $this->base->cache->remove('setting');
    }

    /*读取view文件夹，获取模板的选项*/
    function tpl_list() {
        $tpllist=array();
        $filedir=APP_ROOT.'/view';
        $handle=opendir($filedir);
        while($filename=readdir($handle)) {
            if (is_dir($filedir.'/'.$filename) && '.'!=$filename{0} && 'admin'!=$filename) {
                $tpllist[]=$filename;
            }
        }
        closedir($handle);
        return $tpllist;
    }

 
}
